<template>
    <svg
        aria-hidden="true"
        :class="`svg-icon ${className}`"
        :style="{ fontSize: size, color }"
    >
        <use :href="symbolId" :fill="color" :stop-color="color" />
    </svg>
</template>

<script lang="ts" setup>
const props = defineProps({
    prefix: {
        type: String,
        default: 'icon'
    },
    name: {
        type: String,
        required: true
    },
    className: {
        type: String,
        default: ''
    },
    // 颜色
    color: {
        type: String,
        default: '#333',
    },
    // 大小
    size: {
        type: String,
        default: '16px',
    },
})
const symbolId = computed(() => `#${props.name}`)
</script>

<style scope lang="scss">
.svg-icon {
    position: relative;
    width: 1em;
    height: 1em;
    vertical-align: -2px;
    fill: currentColor;
}
</style>
